package cn.edu.scau.cmi.chensixiao.javaFX;


import cn.edu.scau.cmi.chensixiao.simpleFactoryMethod.Insurance;
import cn.edu.scau.cmi.chensixiao.simpleFactoryMethod.InsuranceFactory;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.image.ImageView;

public class simpleFactoryController {
	@FXML
	private ImageView photo;
	@FXML
	private Label nameLabel;
	@FXML
	private Label idLabel;
	@FXML
	private Label insurLabel;
	@FXML
	private ChoiceBox<String> insurType;
	@FXML
	private Button messageButton;
	@FXML
	private TextArea messageText;
	

	public void initialize() {
		insurType.getItems().addAll("车上人员责任险","车辆损失险","其他事故");
		
	}
	
	
	public void buttonOnClick() {
		//new Alert(Alert.AlertType.INFORMATION,"请先选择保险类型").showAndWait();
		Insurance insurance;
		String insuranceType = insurType.getValue();
		insurance = InsuranceFactory.getInstance(insuranceType);
		messageText.setText(insurance.showMessage());
	}
	
	
	
}
